<template>
	<div v-loading="loading" class="app-container wid100" style="height: calc(100vh - 100px);">
		<div class="m-content-box" v-if="authenFind === 0 || authenFind.check_status === 0 || authenFind.check_status === 2">
			<div class="seal-manage-empty">
				<div class="seal-manage-empty__title">您尚未进行实名认证，还没有印章，请先进行实名认证</div>
				<router-link to="/contract/realNameCertified">
					<el-button type="warning" class="bac6b7">实名认证</el-button>
				</router-link>
			</div>
		</div>
		<iframe v-else class="wh100" style="border: none" 
			:src="url"></iframe>
	</div>
</template>

<script>
	import {
		getXuan
	} from '@/utils/limits.js'
	import {
		mapGetters
	} from 'vuex' // Secondary package based on el-pagination
	import {
		uploadimg,
		sendCode
	} from '@/api/utils'
	import {
		getAuthenFind,
		getWebUrl
	} from '@/api/contract'
	export default {
		name: 'sealManage',
		components: {},
		data() {
			return {
				authenFind: {},
				url: '',
				loading:false
			}
		},
		computed: {
			...mapGetters([
				'permission_routes',
				'roles'
			])
		},
		created() {
			var xuanList = [{
				name: '印章管理',
				url: '/contract/sealManage',
				pd: true
			}]
			var xuanList1 = getXuan(xuanList, this.roles)
			this.$store.dispatch('user/changeXuan', {
				key: 'xuanList',
				value: xuanList1
			})
			this.$store.dispatch('user/changeXuan', {
				key: 'xuan',
				value: 0
			})
			this.loading = true
			this.getAuthenFind()
		},
		methods: {
			getAuthenFind() {
				this.is_show = false
				getAuthenFind().then(response => {
					const {
						data
					} = response
					this.authenFind = data.data
					if(this.authenFind !== 0 && this.authenFind.check_status === 1){
						this.getWebUrl()
					}else{
						this.loading = false
					}
				}).catch(error => {
					console.log(error)
					this.loading = false
				})
			},
			getWebUrl(){
				getWebUrl({
					'embedType':'PREVIEW_SEAL_LIST',
					'businessIds':this.authenFind.od
				}).then(response => {
					const {
						data
					} = response
					this.loading = false
					this.url = data
				}).catch(error => {
					console.log(error)
					this.loading = false
				})
			}
		}
	}
</script>

<style scoped>
	.app-container{
		padding: 20px;
	}
	.edit-input {
		padding-right: 100px;
	}

	.cancel-btn {
		position: absolute;
		right: 15px;
		top: 10px;
	}

	.typelists {
		cursor: pointer;
		margin-right: 30px;
		margin-bottom: 10px;
		vertical-align: middle;
		font-size: 12px;
	}

	.typexuan {
		color: #41c3a8;
	}

	::v-deep .el-table--enable-row-hover .el-table__body tr:hover>td {
		background-color: #616b74;
		color: #fff;
	}

	::v-deep .el-table--enable-row-hover .el-table__body tr>td {
		color: #000;
	}

	/* ::v-deep .el-table__body .el-table__row.hover-row td {
		background-color: #616b74
	} */

	.m-content-box {
		padding: 30px 63px;
	}

	.seal-manage-empty {
		padding-top: 90px;
		text-align: center;
	}

	.seal-manage-empty__title {
		margin-bottom: 40px;
		font-size: 24px;
		font-weight: 700;
		line-height: 1;
	}
</style>